package com.springboot.cloud.authorization.provider;

import com.springboot.cloud.authorization.entity.Role;
import com.springboot.cloud.core.model.SystemUser;
import com.springboot.cloud.core.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Set;

/**
 * <p> 调用远程的 system-service 服务</p>
 *
 * @author Bertram
 * @since 7/15/2019 10:43 PM
 */
@FeignClient(name = "system-service", fallback = SystemProviderFallback.class)
public interface SystemProvider {
    /**
     * 根据唯一标识查询管理员信息
     * @param uniqueId
     * @return
     */
    @GetMapping(value = "/system_user/get_user")
    Result<SystemUser> getUserByUniqueId(@RequestParam("uniqueId") String uniqueId);

    /**
     * 获取用户的所有角色
     * @param userId
     * @return
     */
    @GetMapping(value = "/role/user/{userId}")
    Result<Set<Role>> queryRolesByUserId(@PathVariable("userId") String userId);
}
